import QtQuick
import QtQuick.Controls
import QtQuick.Layouts

Item {
    id: topAreaBack

    width: 1920 - 150
    height: 70

    property real fontSize: Cpp_Language.CurrentLanguage === 1 ? 40 : Cpp_Language.CurrentLanguage === 2 ? 25 : Cpp_Language.CurrentLanguage === 3 ? 30 : 40

    Rectangle{
        anchors.left: parent.left
        anchors.leftMargin: 10
        anchors.verticalCenter: parent.verticalCenter
        width: 280
        height: 70
        visible: Cpp_PLC.M_6
        color: "transparent"

        Text{
            anchors.centerIn: parent
            font.pixelSize: fontSize
            color: "blue"
            text: qsTr("设备回零中")
        }

    }
    Rectangle{
        anchors.left: parent.left
        anchors.leftMargin: 10
        anchors.verticalCenter: parent.verticalCenter
        width: 280
        height: 70
        visible: Cpp_PLC.M_7
        color: "transparent"

        Text{
            anchors.centerIn: parent
            font.pixelSize: fontSize
            color: "red"
            text: qsTr("设备定位中")
        }

    }
    Rectangle{
        anchors.left: parent.left
        anchors.leftMargin: 10
        anchors.verticalCenter: parent.verticalCenter
        width: 280
        height: 70
        visible: Cpp_PLC.M_9
        color: "transparent"

        Text{
            anchors.centerIn: parent
            font.pixelSize: fontSize
            color: "red"
            text: qsTr("设备找零中")
        }

    }
    Rectangle{
        anchors.left: parent.left
        anchors.leftMargin: 10
        anchors.verticalCenter: parent.verticalCenter
        width: 280
        height: 70
        visible: Cpp_PLC.M_96
        color: "transparent"

        Text{
            anchors.centerIn: parent
            font.pixelSize: fontSize
            color: "blue"
            text: qsTr("超长加工中")
        }

    }
    Rectangle{
        anchors.left: parent.left
        anchors.leftMargin: 10
        anchors.verticalCenter: parent.verticalCenter
        width: 280
        height: 70
        visible: Cpp_PLC.M_103
        color: "transparent"

        Text{
            anchors.centerIn: parent
            font.pixelSize: fontSize
            color: "blue"
            text: qsTr("超长定位中")
        }

    }
    Rectangle{
        anchors.left: parent.left
        anchors.leftMargin: 10
        anchors.verticalCenter: parent.verticalCenter
        width: 280
        height: 70
        visible: Cpp_PLC.M_97
        color: "transparent"

        Text{
            anchors.centerIn: parent
            font.pixelSize: fontSize
            color: "blue"
            text: qsTr("超短加工中")
        }

    }
    Rectangle{
        anchors.left: parent.left
        anchors.leftMargin: 10
        anchors.verticalCenter: parent.verticalCenter
        width: 280
        height: 70
        visible: Cpp_PLC.M_98
        color: "transparent"

        Text{
            anchors.centerIn: parent
            font.pixelSize: fontSize
            color: "blue"
            text: qsTr("角码加工中")
        }

    }

    Alarm_Area{     // 报警跑马灯
        anchors.left: parent.left
        anchors.leftMargin: 330
        anchors.verticalCenter: parent.verticalCenter
        width: 800
        height: 70
        bgWidth: 800
        bgHeight: 70
        scrollSpeed: 150
        textColor: "red"
        textSize: fontSize

        var1: Cpp_PLC.M_2
        var2: Cpp_PLC.M_3
        var3: Cpp_PLC.M_31
        var4: Cpp_PLC.M_36

        alarm1Text: qsTr("急停有效!!!")
        alarm2Text: qsTr("伺服报警!!!")
        alarm3Text: qsTr("正向限位超程!!!")
        alarm4Text: qsTr("反向限位超程!!!")

    }

    Rectangle{
        anchors.bottom: parent.bottom
        width: 1920 - 150
        height: 1
        color: "black"
    }

    Rectangle{
        anchors.verticalCenter: parent.verticalCenter
        anchors.right: parent.right
        anchors.rightMargin: 240
        width: 400
        height: 60
        color: "transparent"
        // border.width: 1

        Text{
            anchors.left: parent.left
            anchors.leftMargin: 5
            anchors.verticalCenter: parent.verticalCenter
            font.pixelSize: fontSize
            font.bold: true
            text:qsTr("当前位置: ")
        }
        Text{
            anchors.right: parent.right
            anchors.rightMargin: 30
            anchors.verticalCenter: parent.verticalCenter
            font.pixelSize: 40
            font.bold: true
            text: Cpp_PLC.Current_Location
        }



    }


    Rectangle{
        anchors.verticalCenter: parent.verticalCenter
        anchors.right: parent.right
        anchors.rightMargin: 10
        width: 200
        height: 60
        border.width: 1
        color: Cpp_PLC.PLC_ConnectState ?  "green" : "red"

        Text{
            anchors.centerIn: parent
            font.pixelSize: fontSize
            font.bold: true
            color: Cpp_PLC.PLC_ConnectState ?   "black" : "white"
            text: Cpp_PLC.PLC_ConnectState ? qsTr("已连接") : qsTr("已断开")
        }

    }

}
